#include "drivernumbercontroller.h"

DrivernumberController::DrivernumberController(QWidget *parent)
{

    drivernumberView = new DrivernumberView(parent);
    closeView();
    numStrl = "";
    //绑定按钮信号
    connect(drivernumberView,&DrivernumberView::clickBtnIndex,this,&DrivernumberController::menuClickBtnIndex);

    //点击退出
    connect(drivernumberView->closebtn,SIGNAL(clicked()),this,SLOT(closeView()));
    //点击确认
     connect(drivernumberView->verifybtn,SIGNAL(clicked()),this,SLOT(verifyFun()));
}

void DrivernumberController::show()
{
    drivernumberView->setGeometry(0,0,drivernumberView->width() ==0 ?384:0,drivernumberView->height()==0?558:0);

}

void DrivernumberController::menuClickBtnIndex(int index)
{
    if(index == 10){
        numStrl.chop(1);
    }else {
        index = index == 11 ? 0:index;
        numStrl += QString::number(index);
    }
    drivernumberView->numberLabel->setText(numStrl);
}

void DrivernumberController::closeView()
{
    drivernumberView-> setGeometry(0,0,0,0);
}

void DrivernumberController::verifyFun()
{
    qDebug() <<"司机号 " << numStrl;
}

DrivernumberController::~DrivernumberController()
{

}
